public class Solution {
    public static void main(String[] args) {

        int arr[] = {11, 22, 33, 44, 55};
//        Print(arr);
//
//        System.out.print("\n");
//        System.out.println(MaxFind(arr));
//
//        int outcome = FindArr(arr, 33);
//        if (outcome != 0) {
//            System.out.println("找到了，下标为" + outcome);
//        } else {
//            System.out.println("没找到");
//        }

//        int newarr[]=new int[3];
//        newarr=copyOfRange(arr,1,3);
//        for (int i = 0; i < newarr.length; i++) {
//            System.out.println(newarr[i]);
//        }


        //传递基本数据类型时，传递的是真实的数据，形参的改变，不影响实际参数的值

    }

    public static int[] copyOfRange(int arr[], int from, int to) {
    int newarr[]=new int[to-from+1];
        for (int i = from,j=0; i <=to; i++,j++) {
            newarr[j]=arr[i];
        }
        return newarr;
    }

    public static void Print(int arr[]) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static int MaxFind(int arr[]) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        return max;
    }

    public static int FindArr(int arr[], int Find) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == Find) {
                return i;
            }
        }
        return 0;

    }
}
